<style>
    .btn-select{
        background-color: #0b97c4;
    }
</style>
<div id="dialogSpec" class="modal fade bs-modal-sm" tabindex="-2" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">${msg['goods.type.column.chooseStandard']}</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-xs-12">
                        <!--#for(o in obj){#-->
                        <input type="radio" name="spec" value="${o.id!}"><span>${o.name!}<!--#if(o.aliasName!=""){#--> (${o.aliasName!})  <!--#}#-->&nbsp;</span>
                        <!--#}#-->
                    </div>
                    <div class="col-xs-12" style="padding-top: 5px;">
                        <div id="specList"></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">${msg['globals.button.cancel']}</button>
                <button id="dialogSpecOK" type="button" class="btn btn-primary" data-loading-text="${msg['globals.button.enter']}">${msg['globals.button.confirm']}</button>
            </div>
        </div>
    </div>
</div>
<script language="JavaScript">
    $(document).ready(function () {
        $("#specList ").unbind("click").on("click","button",function(){
            if($(this).hasClass("btn-default")){
                $(this).removeClass("btn-default");
                $(this).addClass("btn-select")
            }else if($(this).hasClass("btn-select")){
                $(this).removeClass("btn-select");
                $(this).addClass("btn-default")
            }
        });
        $("#dialogSpec input[type=radio]").on("click",function(){
            $.post("${base!}/platform/goods/type/spec_val/" + $(this).val(), {}, function (data) {
                if(data.code==0){
                    var str="";
                    $.each(data.data,function(idx,o){
                        str+='<button type="button" class="btn btn-default btn-sm" data-id="'+o.id+'" data-url ="'+o.spec_picurl+'">'+ o.spec_value+'</button> ';
                    });
                    $("#specList").html(str);
                }else{
                    Toast.error(data.msg);
                }
            }, "json");
        });
    });
</script>
